﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Top Manager/Top_Manager.master" AutoEventWireup="true" CodeFile="Invoice_Cancel.aspx.cs" Inherits="Top_Manager_Invoice_Cancel" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <style type="text/css">
    .style2
    {
        width: 3px;
    }
        .style3
        {
            width: 108px;
        }
        .style4
        {
            width: 197px;
        }
        .style5
        {
            margin-bottom: 5px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <table width="100%">
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="style3">
                <strong>Select Invoice No:</strong></td>
            <td>
                <dx:ASPxComboBox ID="ASPxComboBox1" runat="server" ClientIDMode="AutoID"  
                        DropDownStyle="DropDown" IncrementalFilteringMode="StartsWith"
                 DataSourceID="SqlDataSource1"                         
                    TextField="R_ID" TextFormatString="{0}"  ValueType="System.String"
                            ValueField="R_ID" 
                        CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass" 
                       
                        SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css" 
                    Width="200px" AutoPostBack="True" onselectedindexchanged="ASPxComboBox1_SelectedIndexChanged" 
                        >
                        <LoadingPanelImage Url="~/App_Themes/BlackGlass/Editors/Loading.gif">
                        </LoadingPanelImage>
                        <ButtonStyle Width="11px">
                        </ButtonStyle>
                        <ValidationSettings ErrorText="Error has occurred">
                            <ErrorFrameStyle ImageSpacing="4px">
                                <ErrorTextPaddings PaddingLeft="4px" />
                            </ErrorFrameStyle>
                        </ValidationSettings>
                    </dx:ASPxComboBox>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                Total Amount</td>
            <td>
                <dx:ASPxTextBox ID="ASPxTextBox1" runat="server" ReadOnly="True" Width="170px">
                </dx:ASPxTextBox>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                Total PV</td>
            <td>
                <dx:ASPxTextBox ID="ASPxTextBox2" runat="server" ReadOnly="True" Width="170px">
                </dx:ASPxTextBox>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                Total BV</td>
            <td>
                <dx:ASPxTextBox ID="ASPxTextBox3" runat="server" ReadOnly="True" Width="170px">
                </dx:ASPxTextBox>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                Cashier Name</td>
            <td>
                <dx:ASPxTextBox ID="ASPxTextBox4" runat="server" ReadOnly="True" Width="170px">
                </dx:ASPxTextBox>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                Date</td>
            <td>
                <dx:ASPxTextBox ID="ASPxTextBox5" runat="server" ReadOnly="True" Width="170px">
                </dx:ASPxTextBox>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                Distributor</td>
            <td>
                <dx:ASPxTextBox ID="ASPxTextBox6" runat="server" Height="16px" ReadOnly="True" 
                    Width="380px">
                </dx:ASPxTextBox>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                <dx:ASPxRadioButton ID="ASPxRadioButton1" runat="server" Checked="True" 
                    Text="Panadura" GroupName="branch">
                </dx:ASPxRadioButton>
            </td>
            <td>
                <dx:ASPxRadioButton ID="ASPxRadioButton2" runat="server" CssClass="style5" 
                    Text="Kandy" GroupName="branch">
                </dx:ASPxRadioButton>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td colspan="4">
                 <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" 
                    ClientIDMode="AutoID" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
                    CssPostfix="BlackGlass" DataSourceID="SqlDataSource2" KeyFieldName="Pro_ID;Code;Qty" 
                    Width="100%" CssClass="dxnbLargeItemImgBottom_BlackGlass">
                    <Columns>
                         <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                <HeaderTemplate>
                    <dx:ASPxCheckBox ID="SelectAllCheckBox" runat="server" ToolTip="Select/Unselect all rows on the page"
                        ClientSideEvents-CheckedChanged="function(s, e) { ASPxGridView1.SelectAllRowsOnPage(s.GetChecked()); }" />
                </HeaderTemplate>
                             <ClearFilterButton Visible="True">
                             </ClearFilterButton>
                <HeaderStyle HorizontalAlign="Center" />
            </dx:GridViewCommandColumn>
                        <dx:GridViewDataTextColumn FieldName="Pur_ID" VisibleIndex="0" ReadOnly="True" 
                            Caption="Invoice ID">
                            <EditFormSettings Visible="False" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Pro_ID" ReadOnly="True" VisibleIndex="1" 
                            Caption="Item ID">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Code" ReadOnly="True" VisibleIndex="2" 
                            Caption="Item Code">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn Caption="Item" FieldName="Pro_Name" 
                            ShowInCustomizationForm="True" VisibleIndex="3">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="PV" VisibleIndex="4">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="BV" VisibleIndex="5">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Price" VisibleIndex="6">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Qty" VisibleIndex="7" Caption="Quantity">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Toatal_PV" VisibleIndex="8" 
                            Visible="False">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Total_BV" VisibleIndex="9" 
                            Visible="False">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="cashier_Name" VisibleIndex="10" 
                            Visible="False">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataDateColumn FieldName="Rcpt_Date" VisibleIndex="11" 
                            Visible="False">
                        </dx:GridViewDataDateColumn>
                        <dx:GridViewDataTextColumn FieldName="Expr2" VisibleIndex="12" ReadOnly="True" 
                            Visible="False">
                            <EditFormSettings Visible="False" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Expr1" VisibleIndex="13" Visible="False">
                        </dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="D_id" VisibleIndex="14" Visible="False"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="D_name" VisibleIndex="15" Visible="False">
                        </dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="Total_Price" VisibleIndex="16" Visible="False"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Use_ID" ReadOnly="True" VisibleIndex="17" 
                            Visible="False">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="Status" VisibleIndex="18" Visible="False">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="User_Create" VisibleIndex="19" 
                            Visible="False">
                        </dx:GridViewDataTextColumn>
<dx:GridViewDataDateColumn FieldName="Date_Create" VisibleIndex="20" Visible="False"></dx:GridViewDataDateColumn>
                        <dx:GridViewDataDateColumn FieldName="Last_Modify" VisibleIndex="21" 
                            Visible="False">
                        </dx:GridViewDataDateColumn>
<dx:GridViewDataTextColumn FieldName="Key_Timestamp" VisibleIndex="22" Visible="False"></dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="R_ID" Visible="False" VisibleIndex="23">
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <SettingsBehavior AllowSelectByRowClick="True" />
                    <SettingsPager PageSize="25">
                    </SettingsPager>
                    <Settings ShowFilterRow="True" />
                    <Images SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css">
                        <LoadingPanelOnStatusBar Url="~/App_Themes/BlackGlass/GridView/gvLoadingOnStatusBar.gif">
                        </LoadingPanelOnStatusBar>
                        <LoadingPanel Url="~/App_Themes/BlackGlass/GridView/Loading.gif">
                        </LoadingPanel>
                    </Images>
                    <ImagesFilterControl>
                        <LoadingPanel Url="~/App_Themes/BlackGlass/Editors/Loading.gif">
                        </LoadingPanel>
                    </ImagesFilterControl>
                    <Styles CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
                        CssPostfix="BlackGlass">
                        <Header ImageSpacing="5px" SortingImageSpacing="5px">
                        </Header>
                    </Styles>
                    <StylesEditors>
                        <CalendarHeader Spacing="1px">
                        </CalendarHeader>
                        <ProgressBar Height="25px">
                        </ProgressBar>
                    </StylesEditors>
                </dx:ASPxGridView>
                </td>
        </tr>
        <tr>
            <td class="style4">
                <dx:ASPxLabel ID="ASPxLabel2" runat="server" ForeColor="Red">
                </dx:ASPxLabel>
            </td>
            <td class="dxtcRightAlignCell_BlackGlass">
                <dx:ASPxLabel ID="ASPxLabel3" runat="server" ForeColor="#009900">
                </dx:ASPxLabel>
            </td>
            <td>
                &nbsp;</td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style4">
                &nbsp;</td>
            <td class="dxtcRightAlignCell_BlackGlass">
                &nbsp;</td>
            <td>
                <dx:ASPxButton ID="ASPxButton1" runat="server" ClientIDMode="AutoID" 
                    CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" CssPostfix="BlackGlass" 
                    onclick="ASPxButton1_Click" 
                    SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css" 
                    Text="Cancel Invoice">
                </dx:ASPxButton>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
                    
                    
                    SelectCommand="SELECT Tbl_Receipt.Toatal_PV, Tbl_Receipt.Total_BV, Tbl_Receipt.cashier_Name, Tbl_Receipt.Rcpt_Date, Tbl_Receipt.R_ID AS Expr2, Tbl_UserPurchase.R_ID AS Expr1, Tbl_Receipt.D_id, Tbl_Receipt.D_name, Tbl_Receipt.Total_Price, Tbl_UserPurchase.Pur_ID, Tbl_UserPurchase.Use_ID, Tbl_UserPurchase.Pro_ID, Tbl_UserPurchase.Code, Tbl_UserPurchase.Qty, Tbl_UserPurchase.Price, Tbl_UserPurchase.PV, Tbl_UserPurchase.BV, Tbl_UserPurchase.Status, Tbl_UserPurchase.User_Create, Tbl_UserPurchase.Date_Create, Tbl_UserPurchase.Last_Modify, Tbl_UserPurchase.Key_Timestamp, Tbl_UserPurchase.R_ID, Tbl_Product.Pro_Name FROM Tbl_UserPurchase INNER JOIN Tbl_Receipt ON SUBSTRING(Tbl_UserPurchase.R_ID, 3, 7) = Tbl_Receipt.R_ID INNER JOIN Tbl_Product ON Tbl_UserPurchase.Pro_ID = Tbl_Product.Pro_ID AND Tbl_UserPurchase.Code = Tbl_Product.Code WHERE (Tbl_Receipt.R_ID = @R_ID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ASPxComboBox1" Name="R_ID" 
                            PropertyName="Value" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
                    DeleteCommand="DELETE FROM [Tbl_Receipt] WHERE [R_ID] = @R_ID" 
                    SelectCommand="SELECT [R_ID] FROM [Tbl_Receipt]">
                    <DeleteParameters>
                        <asp:Parameter Name="R_ID" Type="Int32" />
                    </DeleteParameters>
                </asp:SqlDataSource>
            </td>
            <td class="style2" width="100%">
                &nbsp;</td>
        </tr>
        </table>
    <br />
</asp:Content>

